Repository navigation
fix(plugin-grid): keep draft-only fields out of a grouped grid's requests under draft preview - #34944
Conversation
…ests Under the console's draft preview the object definition marks each field only the draft declares `_draftOnly`. The grid now leaves such a field out of its row `$select` and `$expand`, and refuses it as a grouping key the way a masked key is refused: the grid groups by the published entries left, or draws flat, and says so in one note (`grid.grouping.draftOnly`). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
…eview Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
…id-draft-only-fields
|
repo:objectstack#3 · os-support-ai · session_01WGufzhshTXCAmv9KJXRZkB L1 review · 2026-11-17T17:53ZL1: ACCEPT What I read at this head
Checklist
Must-fixNone. Should-fixNone. The two points o3-A asked me to judge
Notes / nits
CI at review timeThere are 58 check-runs on this sha, all completed, 0 failed. Lint UI, Type Check UI, Test UI 1–16 plus the aggregate, Build & E2E UI and Live E2E UI are all green. RoutingL1 ACCEPT. There is no L2 (locale-only Clause-②), and the PR is not governed. The area lands it after #34936, or with it, with CI green on the landing head. The sort carrier above is owed separately. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzg2evNa1V3zxrQq3KX Landing · 2026-11-17T18:00Z · area o3-A
State: Merge standard: no must-fix or should-fix is open.
Dev-effort: medium · Rounds: 1 |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 44146444637 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Requested by Yibo Wang · project thread
repo:objectstack#3 · os-support-ai · session_01WGufzg2evNa1V3zxrQq3KX
Fixes #34898
Clause-②: yes — one new locale key (the visible "this grouping waits for publish" note the card's Expected names), locale-only; no spec, no new exported prop
Metadata-protocol: none
维护者速读
_draftOnly标记时生效,预览之外没有标记,行为不变;回滚即撤销本 PR。objectGridGroupingDecisions.ts(分组键剔除,和已有的掩码键剔除同一路径)、objectGridRowLoad.ts(withoutDraftOnly与$expand过滤)、ObjectGrid.tsx(提示行)。cd ui && pnpm --filter @object-ui/plugin-grid exec vitest run --root ../.. packages/plugin-grid/src/__tests__/serverGroupedDraftOnly-34898.test.tsx,预期 7 个测试全部通过。What changes
@object-ui/plugin-gridnow reads the_draftOnlymarker off the object definition it already fetches (getObjectSchema,objectGridRowLoad.ts), with module-private helpers and nothing new exported.$selectpasses one last filter (withoutDraftOnly), so a column, a grouping key and every harvested operand (predicate,referenceVia,dependsOnand the rest) follow one rule, on the flat fetch and on every group's row page. A draft-only relation is also left out of$expand, because the door checks$expandnames against the published object too. The column still draws, empty, under its draft label.objectGridGroupingDecisions.ts). It is dropped fromunmaskedGroupingFields, so it is never sent asgroupBy. It also counts nowhere inserverGroupedFetch,groupingNeedsHeaderQueryor the fetch-window choice. The grid groups by the published entries left, or draws ungrouped.useServerGrouping.tsneeded no change: itsgroupBycomes from the server grouping fields, which come fromunmaskedGroupingFields.grid.grouping.draftOnly("Not grouped by FIELDS: it exists only in the draft until you publish."), naming each dropped field by its label. It is defined inObjectGrid.tsxdirectly after thegrid.grouping.needsHeaderQuerypanel, and it is drawn under the description and above the rows, in the table branch and in the card view.needsHeaderQueryis an early return that replaces the grid with an error panel. This case withholds nothing, so drawing it in that spot would hide the rows it explains. Drawing it above the rows, in the same muted stripListViewuses for its own draft-preview note (Draft preview: a field that exists only in the draft is missing from the New record form, and a draft list column on it makes the list query refused #34807 list half), means it is read before the rows and looks the same on both surfaces.enand the other 10 packs (zh-Hant regenerated withgen-zh-hant.mjs), and toGRID_DEFAULT_TRANSLATIONS, byte-identical toen.Why
Under
?preview=draftthe console's data source returns the published definition plus each field only the draft declares, marked_draftOnly. The data door still checks every$selectandgroupByname against the published object (assertProjectionFieldsExist,assertGroupByFieldsExist). The grid built its own requests from that definition and treated the marked field as declared.Premise, measured on origin/main
189358f212before the fix (the grid source restored from that commit, the realObjectGrid, and a double whosegetObjectSchemamarkspriority_draftOnlyand which refuses any request naming it):$select["id","name","priority","category"], and both groups drewINVALID_FIELD: select 'priority'.queryGroupHeadersgotgroupBy: ["priority"], and the grid drew "Error loading grid".Tests
New file
ui/packages/plugin-grid/src/__tests__/serverGroupedDraftOnly-34898.test.tsx, 7 pins. Its double projects rows the way the door does: only the selected keys come back.['id','name','category'], there are no group errors, the column header draws and its cells are empty, and no note shows.$selectis['id','name'].['id','name','priority','category'], and the values draw.queryGroupHeadersis never called, there is no "Error loading grid", the grid draws flat, and the note names "Priority".groupByis['category'], and the note names "Priority".groupByis[['priority']], and no note shows.groupBy['priority']arriving, the last row page selectingpriority, and no errors.Reverse verification: the pins against origin/main's grid source (5 red, 2 controls green)
Ablation: the draft-only grouping gate disabled, through scripts/ablation-replace.mjs (3 grouping pins red, restored to HEAD)
The source is imported relatively (
../ObjectGrid), so nodist/sits on the path and no rebuild was needed for the ablation.Acceptance notes
withUnpublishedObjectReadsinui/packages/app-shell/src/preview/unpublishedObjectReads.ts). On origin/main nothing marks a field yet, so this PR is inert in the running console until that PR lands. The pins drive the grid with a marked definition directly.sort,searchableFieldsor a viewfilterthat names a draft-only field would still reach the door from this grid. This is read from the code only. No repro was run, so nothing was filed.62fbbeb767),i18n-locale-enreads 61,869 gzipped bytes against a 62,000 ceiling, leaving 131 bytes. The same build without this key reads 61,841, so the key costs +28 bytes. feat(ui): a timesheet list view, an editable row × weekday entry grid #34925, fix(app-shell,console): the invitation inbox's accept routes an unverified address to verification, and the verify screen says a link was sent only when one was #34929 and the Draft preview: a field that exists only in the draft is missing from the New record form, and a draft list column on it makes the list query refused #34807 list half each add anenkey too. Stacked, they may exceed the ceiling. The ceiling is not edited here. If it is exceeded,grid.grouping.*could move to a lazy namespace.Verification
Package tests and type-checks (pre-merge head 7aaf77a; the merge of origin/main touched neither package)
Targeted re-run on the final head 3551840
Derived gate families (dispatch-gates --commands), 41 of 41 exit 0
Measured on the pre-merge head 7aaf77a. Every family CI runs reports on this PR's check-runs.
Eager closure (turbo build of the console closure, VITE_BASE_PATH=/console/ vite build, check:eager-closure) on merged head 3551840
node scripts/pm/overlap-check.mjs --branch=claude/issue-34898-grid-draft-only-fieldsat push:VERDICT clean exit 0.Human Minimum
packages/specholds no runtime logic. (No spec change.)pnpm lintpasses. (Lint is CI's run.)main, one pull request.packages/spectouched: not touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX